package com.myidis.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.myidis.response.AnalysisResult_Res;
import com.myidis.servlet.AnalysisResultServlet;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Controller
@RequestMapping("/anaRes")
@Api(tags = "分析结果相关接口")
public class AnalysisResultController {
	@Autowired
	private AnalysisResultServlet anaResServlet;
	
	@ResponseBody
	@ApiOperation("基于某指标作为基准指标的分析结果查询")
	@RequestMapping(value="/search",method=RequestMethod.POST,consumes= MediaType.APPLICATION_JSON_VALUE)
	public List<AnalysisResult_Res> peakValley(@RequestBody int baseQuota) {
		return anaResServlet.searchResult(baseQuota);
	}
	
	@ResponseBody
	@ApiOperation("删除某个分析结果")
	@RequestMapping(value="/del",method=RequestMethod.POST)
	public int del(@RequestBody int id) {
		return anaResServlet.delete(id);
	}
	
	@ResponseBody
	@ApiOperation("删除一组分析结果")
	@RequestMapping(value="/delAll",method=RequestMethod.POST)
	public int delAll(@RequestBody int[] ids) {
		return anaResServlet.deleteAll(ids);
	}
}
